package com.macro.mall.portal.controller;

import com.macro.mall.common.api.CommonPage;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.model.BmsExhibitionsActivities;

import com.macro.mall.model.BmsExhibitionsActivitiesGoods;
import com.macro.mall.portal.dto.BmsExhibitionsActivitiesGoodsParam;
import com.macro.mall.portal.dto.BmsExhibitionsActivitiesParam;
import com.macro.mall.portal.service.BmsExhibitionsActivitiesService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 展览活动Controller
 * Created by macro on 2018/4/26.
 */
@Controller
@Api(tags = "BmsExhibitionsActivitiesController")
@Tag(name = "BmsExhibitionsActivitiesController", description = "展览活动管理")
@RequestMapping("/mpList")
public class BmsExhibitionsActivitiesController {
    @Autowired
    private BmsExhibitionsActivitiesService bmsExhibitionsActivitiesService;




    @ApiOperation("展览活动")
    @RequestMapping(value = "/list", method = RequestMethod.POST)
    @ResponseBody
    public CommonResult<CommonPage<BmsExhibitionsActivities>> getList(@RequestBody BmsExhibitionsActivitiesParam bmsExhibitionsActivitiesParam) {
        List<BmsExhibitionsActivities> bmsExhibitionsActivitiesList = bmsExhibitionsActivitiesService.list(bmsExhibitionsActivitiesParam);
        return CommonResult.success(CommonPage.restPage(bmsExhibitionsActivitiesList));
    }

    @ApiOperation("展览活动详情")
    @RequestMapping(value = "/{id}", method = RequestMethod.GET)
    @ResponseBody
    public CommonResult<BmsExhibitionsActivities> getItem(@PathVariable Long id) {
        BmsExhibitionsActivities bmsExhibitionsActivities = bmsExhibitionsActivitiesService.detail(id);
        return CommonResult.success(bmsExhibitionsActivities);
    }

    @ApiOperation("相关展品")
    @RequestMapping(value = "/goods", method = RequestMethod.POST)
    @ResponseBody
    public CommonResult<CommonPage<BmsExhibitionsActivitiesGoods>> getList(@RequestBody BmsExhibitionsActivitiesGoodsParam bmsExhibitionsActivitiesParam) {
        List<BmsExhibitionsActivitiesGoods> bmsExhibitionsActivitiesGoodsList = bmsExhibitionsActivitiesService.goods(bmsExhibitionsActivitiesParam);
        return CommonResult.success(CommonPage.restPage(bmsExhibitionsActivitiesGoodsList));
    }

    @ApiOperation("全景VR")
    @RequestMapping(value = "/vr", method = RequestMethod.POST)
    @ResponseBody
    public CommonResult<BmsExhibitionsActivities> getVR(@RequestBody BmsExhibitionsActivitiesParam bmsExhibitionsActivitiesParam) {
        BmsExhibitionsActivities bmsExhibitionsActivitiesList = bmsExhibitionsActivitiesService.getVR(bmsExhibitionsActivitiesParam);
        return CommonResult.success(bmsExhibitionsActivitiesList);
    }

    @ApiOperation("相关展品详细")
    @RequestMapping(value = "/goodsDetail/{id}", method = RequestMethod.GET)
    @ResponseBody
    public CommonResult<BmsExhibitionsActivitiesGoods> goodsDetail(@PathVariable Long id) {
        BmsExhibitionsActivitiesGoods bmsExhibitionsActivitiesGoods= bmsExhibitionsActivitiesService.goodsDetail(id);
        return CommonResult.success(bmsExhibitionsActivitiesGoods);
    }
}
